cap log close

global path = "****"

local name= "create_agg_cov_files"
local date = "061020"
global logname = "$path/`name'_`date'.log"

clear
set more off
cd "$path"
log using "$logname", replace

use "$path/Data/penalty_sample.dta", clear


preserve
collapse (count) dep_tin if covered2016-any_dec!=11, by(covered1718 treatment)
rename dep_tin count_ind
label data "All ages & excluding people with coverage each of the first 11 months of 2016"
save "$path/count_by_month_1718_`date'.dta", replace
restore

preserve
keep if age_2017>=45 & age_2017 < 65
collapse (count) dep_tin if covered2016-any_dec!=11, by(covered1718 treatment)
rename dep_tin count_ind
label data "Ages: 45-64 & excluding people with coverage each of the first 11 months of 2016"
save "$path/count_by_month_4564_1718_`date'.dta", replace
restore




log close

